package cn.lun.controller;


import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import cn.lun.biz.UserBiz;
import cn.lun.entity.t_user;
import cn.lun.util.Constants;

@Controller
@RequestMapping("/lun")
public class userController {
	
	@Resource
	public UserBiz userbiz;

	@RequestMapping(value="/login")
	public String logind(@ModelAttribute("userCode")String userCode,
			@ModelAttribute("userPassword")String userPassword,
			HttpSession session)throws Exception{
		System.out.println("aaa");
			  t_user use=userbiz.dengLun(userCode, userPassword);
			if (use!=null) {
				session.setAttribute(Constants.USER_SESSION,use);
			}else{
				
			}
		 return "index";
	}
	
	@RequestMapping(value="/out")
	public String out(HttpSession session){
		session.removeAttribute(Constants.USER_SESSION);
		return "login";
	}
}
